package Test;

public class Test_成员内部类 {
    public static void main(String[] args) {
        Outer outer = new Outer();
        outer.method();
        Outer.Inner inner = new Outer().new Inner();
        System.out.println(inner.num);
        inner.method();
    }
}

class Outer{
    private int num = 100;
    public void method(){
        System.out.println("外部类的method()方法");
        Inner inner = new Inner();
        System.out.println(inner.num);
        System.out.println(inner.num2);
        inner.method();
    }

    class Inner{
        int num = 1;
        private int num2 = 2;
        public void method(){
            System.out.println("这是内部类的method()方法");
            System.out.println(this.num);
            System.out.println(Outer.this.num);
        }
    }
}
